package com.gt.mapper;


import com.github.pagehelper.Page;
import com.gt.pojo.dto.EmployeePageQueryDTO;
import com.gt.pojo.entity.Employee;
import com.gt.pojo.vo.NewStudentsVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface EmployeeMapper {


    @Select("select *from library.user where username = #{username}")
    Employee getByUsername(String username);

    @Insert("insert into library.user(name, username, password, avatar, role, sex, phone, email, create_time,update_time) " +
            "VALUES (#{name},#{username},#{password},#{avatar},#{role},#{sex},#{phone},#{email},#{createTime},#{updateTime})")
    void insert(Employee employee);


    Page<Employee> pageQuery(EmployeePageQueryDTO employeePageQueryDTO);
    /**
     * 根据id查询员工
     * @param id
     * @return
     */
    @Select("select *from library.user where id=#{id}")
    Employee getById(Long id);

    void update(Employee employee);

    @Delete("delete from library.user where id = #{id}")
    void deleteById(Long id);

    @Select("select count(role) from library.user where role = #{role}")
    Integer getByUser(String role);

    List<NewStudentsVO> getNewStudentsByDate();
}
